<?php
include("conf/config.php");
include("bad_status.php");
?>
<!doctype html>
<html>
<head>
    <title>Bad</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.css">
<script type='text/javascript' >
$(window).load(function(){
$("#slider").on("slidestop", function (event,ui) {
var value = event.target.value;

$.ajax({
   url : "http://<?php echo $ccuurl;?>/config/xmlapi/statechange.cgi",
   type : "GET",
   data: {ise_id: "<?php echo $temp_soll_bad;?>", new_value: value },
   dataType: "html"
  });	
  $.ajax({
   url : "http://<?php echo $ccuurl;?>/config/xmlapi/statechange.cgi",
   type : "GET",
   data: {ise_id: "<?php echo $temp_soll_bad;?>", new_value: value },
   dataType: "html"
  });	
});
 	



});
</script>
<script type='text/javascript' >
$(window).load(function(){
$("#flip").on("slidestop", function (event,ui) {
var value = event.target.value;
alert ("test:" + value);
$.ajax({
   url : "http://<?php echo $ccuurl;?>/config/xmlapi/statechange.cgi",
   type : "GET",
   data: {ise_id: "<?php echo $sysvar_badetag;?>", new_value: value },
   dataType: "html"
  });	
 	
});
});
</script>

<script type='text/javascript'>
function refreshPage() {
  $.mobile.changePage(
    window.location.href,
    {
      allowSamePageTransition : true,
      transition              : 'none',
      showLoadMsg             : false,
      reloadPage              : true
    }
  );
}
</script>
	<script type='text/javascript' src="http://code.jquery.com/jquery-1.8.3.js"></script>
    <script type='text/javascript' src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.js"></script>
	</head>
<body>
    <div data-role="page" id="bad" data-dom-cache="true">
 
        <div data-role="header">
		    <a href="index.php" data-role="button" data-iconpos="notext" data-direction="reverse" data-transition="slide" data-icon="back">Zur&uuml;ck</a>
            <h1>Bad</h1>
			<a href="#" data-role="button" data-icon="refresh" data-iconpos="notext" onclick="refreshPage(); return false">Aktualisieren</a>
        </div><!-- /header -->
 
        <div data-role="content">
		
            <p>Temperatur Bad: <?php echo $temp;?> &deg;C </p>
			<p >Feuchte Bad: <?php echo $feuchte;?> &#037;</p>
	<p>
        <form>
		<label for="flip">Badetag?</label>
     	<select name="flip" id="flip" data-role="slider">
		<option value="false">Nein</option>
		<option value="true" <?php echo $selected;?> >Ja</option>
		</select> 
		</form>
	</p>
		<form>
		<label for="slider">Soll Temperatur Bad: <?php echo $soll;?> &deg;C</label>
		<input type="range" name="slider" id="slider" value="<?php echo $soll;?>" min="15" max="30" />
		</form>
	<p>Diagram Verlauf</p>
	
		<img src="grafik_bad.php">
		<p><a href="grafik_bad_2tage.php" data-role="button" data-inline="true" data-mini="true" data-ajax="false">2 Tage</a><a href="grafik_bad_3tage.php" data-role="button" data-inline="true" data-mini="true" data-ajax="false" >3 Tage</a></p>
        </div>
		<!-- /content -->
 
      
 
    </div><!-- /page -->
</body>
</html>